package lex.expression;


public enum TokenType
{
	END, UNKOWN, NUMERIC() {
		@Override
		public boolean isOperand()
		{
			return true;
		}

		@Override
		public boolean isOperator()
		{
			return false;
		}
	},
	ADD, POSITIVE, SUBTRACT, NEGATE, MULTIPLY, DIVIDE, MOD, POWER, FACTORIAL, 
	LEFT_P, RIGHT_P;
	public boolean isOperand()
	{
		return false;
	}

	public boolean isOperator()
	{
		return true;
	}

	public static TokenType parseOperatorType( char ch )
	{
		switch( ch )
		{
		case '+':
			return TokenType.ADD;
		case '-':
			return TokenType.SUBTRACT;
		case '*':
			return TokenType.MULTIPLY;
		case '/':
			return TokenType.DIVIDE;
		case '%':
			return TokenType.MOD;
		case '^':
			return TokenType.POWER;
		case '!':
			return TokenType.FACTORIAL;
		case '(':
			return TokenType.LEFT_P;
		case ')':
			return TokenType.RIGHT_P;
		default:
			return TokenType.UNKOWN;
		}
	}
}
